import { FormSchema } from '/@/components/Form/index';
import { getTemplateList } from '/@/api/flow/workItemProxy';
// 公文设置
export const createFormSchema: FormSchema[] = [
  {
    field: 'moduleID',
    component: 'Select',
    label: '授权模块',

    componentProps: {
      disabled: true,
      options: [{ label: '所有公文', value: 0 }],
    },
  },
  {
    field: 'authStatus',
    component: 'Select',
    label: '授权状态',
    defaultValue: 0,
    componentProps: {
      disabled: true,
      options: [
        { label: '未确认', value: 0 },
        { label: '已确认', value: 1 },
      ],
    },
  },
  {
    field: 'userName',
    component: 'Input',
    label: '授权用户',
    dynamicDisabled: true,
  },
  {
    field: 'proxyUser',
    component: 'HChooseUserBase',
    label: '接收用户',
    required: true,

    componentProps: () => {
      return {
        sceneType: ['PERSON'],
        addressType: 17,
        maxSelect: 1,
      };
    },
  },
  {
    field: 'time',
    component: 'RangePicker',
    label: '时间',
    colProps: {
      span: 24,
    },
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
      // format: 'YYYY-MM-DD',
      showTime: false,
    },
  },
];

// 公文管理---->模板权限分配
export const templateFormSchema: FormSchema[] = [
  {
    field: 'moduleIDList',
    component: 'ApiSelect',
    label: '授权模板',
    required: true,
    componentProps: {
      mode: 'multiple',
      api: getTemplateList,
      showSearch: true,
      filterOption: (input: string, option: any) => {
        return option.label.indexOf(input) >= 0;
      },
      onSearch: (val) => {
        console.log(val);
      },
      allowClear: true,
      labelField: 'templatename',
      valueField: 'templateid',
    },
  },
  {
    field: 'userID',
    component: 'HChooseUserBase',
    label: '授权人员',
    required: true,
    componentProps: {
      sceneType: ['PERSON'],
      addressType: 17,
      maxSelect: 1,
    },
  },
  {
    field: 'deptIDS',
    component: 'HChooseUserBase',
    label: '授权部门',
    required: true,
    componentProps: {
      sceneType: ['DEPT'],
      addressType: 99,
    },
  },
  {
    field: 'adminType',
    component: 'Select',
    label: '授权类别',
    required: true,
    defaultValue: 1,
    componentProps: {
      disabled: true,
      options: [{ label: '分配模板', value: 1 }],
    },
  },
];
